<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Keyword Search Generator</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }

        .container {
            display: flex;
            justify-content: space-between;
        }

        textarea {
            width: 45%;
            height: 200px;
        }

        #searchResults {
            width: 45%;
            margin-left: 10px;
            border: 1px solid #ccc;
            padding: 10px;
        }
    </style>
</head>

<body>
    <div class="container">
        <textarea id="keywordsTextArea" placeholder="Enter one keyword per line"></textarea>
        <button onclick="generateSearchLinks()">Generate Links</button>
        <div id="searchResults"></div>
    </div>
    <script>
        function generateSearchLinks() {
            const keywordsTextArea = document.getElementById('keywordsTextArea');
            const searchResults = document.getElementById('searchResults');

            // 清除之前的结果
            searchResults.innerHTML = '';

            // 获取关键词并分割成数组
            const keywords = keywordsTextArea.value.split('\n').map(keyword => keyword.trim()).filter(keyword => keyword);

            // 遍历关键词并生成链接
            keywords.forEach(keyword => {
                const link = document.createElement('a');
                link.href = `https://www.baidu.com/s?wd=${encodeURIComponent(keyword)}`;
                link.textContent = keyword;
                link.target = '_blank';
                searchResults.appendChild(link);
                searchResults.appendChild(document.createElement('br')); // 换行
            });
        }
    </script>
</body>

</html>